package com.lagou.mr;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class NumBean implements WritableComparable<NumBean> {
    private Integer num;

    //排序
    @Override
    public int compareTo(NumBean o) {
        return this.num.compareTo(o.getNum());
    }

    //序列化
    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(num);
    }

    //反序列化
    @Override
    public void readFields(DataInput in) throws IOException {
        this.num = in.readInt();
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "\t" + num;
    }
}
